package com.xw.base.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xiongwei_vendor
 * @date 2021/10/29 17:54
 */
@Slf4j
@RestController
@RequestMapping("/test")
@Api(value = "TestController | 测试接口")
public class TestController {

    @Autowired
    private MongoTemplate mongoTemplate;

    @GetMapping(value = "/testPage")
    @ApiOperation(value = "测试页面 ", notes = "测试接口")
    public String testPage() {
        log.info("testPage = {}", "测试页面");
        return "ok";
    }

    @GetMapping(value = "/testMongo")
    @ApiOperation(value = "测试页面 ", notes = "测试接口")
    public String testMongo() {
        Query query = new Query();
        mongoTemplate.findOne(query,String.class);
        log.info("testPage = {}", "测试页面");
        return "ok";
    }

}
